import { userInfo } from '@/request/api'
export default{
  namespaced:true,
  state:{
   
    cartTotal:10,
    userInfo12:{
      nickName:'呢称'
      ,coin:"-2-",
      headImg:require('../../assets/img/arrow.png')

    }
  },
  mutations:{
    updataUserInfo(state,payload){
      state.cartTotal=payload.cartTotal
      state.userInfo12=payload.userInfo
    },
    initUserInfo(state){
      state.cartTotal=0,
      state.userInfo12={
        nickName:'呢称'
        ,coin:"-2-",
        headImg:require('../../assets/img/score.png')
      }
    }
  }
  ,
  actions:{
  //  async asyncChangeUserInfo({commit},payload){
  //     let res =await userInfo();
  //     console.log('用户信息：',res)
  //     commit('updataUserInfo',res.data.data)
  //  }
  async asyncChangeUserInfo(context,payload){ 
    let res =await userInfo();
     console.log('用户信息为：',res)
    context.commit('updataUserInfo',res.data.data)
}
  }
}